package com.littleu.yojoincn.service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.littleu.yojoincn.common.exception.http.NotFoundException;
import com.littleu.yojoincn.mapper.BrandMapper;
import com.littleu.yojoincn.model.BrandDO;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BrandService extends ServiceImpl<BrandMapper, BrandDO> {
    public List<BrandDO> getByIsMarket(Integer isMarket){
        return this.baseMapper.selectByIsMarket(isMarket);
    }

    public BrandDO getDetail(Long id){
        BrandDO brandDO = this.getById(id);
        if(brandDO == null){
            throw new NotFoundException(30000);
        }
        return brandDO;
    }
}
